package com.ruoyi.app.controller;

import com.ruoyi.app.domain.Department;
import com.ruoyi.app.domain.Doctor;
import com.ruoyi.app.domain.DoctorSchedule;
import com.ruoyi.app.service.DepartmentService;
import com.ruoyi.app.service.DoctorScheduleService;
import com.ruoyi.app.service.DoctorService;
import com.ruoyi.app.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("doctor")
@RestController
public class DoctorController {
    @Autowired
    DoctorService doctorService;
    @Autowired
    DoctorScheduleService doctorScheduleService;
    @Autowired
    DepartmentService departmentService;

    @RequestMapping("list")
    public Result getDoctorList(Long doctorId)
    {
        Doctor doctor = doctorService.selectDoctorById(doctorId);
        return Result.ok(doctor);
    }

    @RequestMapping("schedule")
    public Result getDoctorSchedule(@RequestParam("doctorId") Long doctorId ,@RequestParam("scheduleId") Long scheduleId)
    {
        DoctorSchedule doctor = doctorScheduleService.selectDoctorById(doctorId,scheduleId);
        return Result.ok(doctor);
    }

    @RequestMapping("sameDepartment")
    public Result getSameDepartment(@RequestParam("doctorId") Long doctorId ,@RequestParam("limit") Integer limit)
    {
        //查询医生获取科室id
        List<Doctor> doctor = doctorService.getselectDoctorById(doctorId,limit);
        return Result.ok(doctor);
    }
}
